#ifndef __WEATHER_API_H__
#define __WEATHER_API_H__

#include "user_extern.h"
#include "system_ctl.h"
#include "citylib.h"
#include "cJSON.h"
#include <netdb.h>
#include <sys/socket.h>

#define WEB_SERVER "api.seniverse.com"
#define WEB_PORT 80
#define REQUEST "GET http://api.seniverse.com/v3/weather/now.json?key=SYIyqgdb6PIQ8mLtn&location=%s&language=en&unit=c   HTTP/1.0\r\nHost: api.seniverse.com\r\nUser-Agent: esp-idf/1.0 esp32\r\n\r\n"

typedef struct _weather{
    /* 城市设置 */
    int8_t     province_code;       /* 省份代码 */
    int16_t    city_code;           /* 天气城市代码 */
    uint8_t    weather_syn;         /* 是否已经同步weather标志位 */
    uint16_t   weather_code;        /* 天气代码 */
    int16_t    weather_temp;        /* 温度 */
    char       weather_text[8];     /* 天气描述 */

    void(*init)(void);
}Weather;

extern Weather weather;

#endif